import sys

from qtpy.QtCore import Qt
from qtpy.QtWidgets import QApplication, QWidget, QVBoxLayout, QPushButton, QFileDialog

from qfluentwidgets_expand import PictureBrowserDialog


class PictureWidget(QWidget):
    def __init__(self):
        super().__init__()
        QPushButton("Open Picture", self).clicked.connect(self.open_picture)
        self.setMinimumSize(1000, 700)

    def open_picture(self):
        dialog = PictureBrowserDialog(self)
        dialog.setPixmap('./resources/test.jpg')
        dialog.show()


if __name__ == '__main__':
    QApplication.setHighDpiScaleFactorRoundingPolicy(
        Qt.HighDpiScaleFactorRoundingPolicy.PassThrough)
    QApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
    app = QApplication(sys.argv)
    demo = PictureWidget()
    demo.show()
    sys.exit(app.exec_())
